package edu.unlv.cs.ladders.entities;

import edu.unlv.cs.ladders.entities.Challenge;
import java.lang.Long;
import java.util.List;

privileged aspect Challenge_Roo_Entity {
    
    public static long Challenge.countChallenges() {
        return (Long) entityManager().createQuery("select count(o) from Challenge o").getSingleResult();
    }
    
    public static List<Challenge> Challenge.findAllChallenges() {
        return entityManager().createQuery("select o from Challenge o").getResultList();
    }
    
    public static Challenge Challenge.findChallenge(Long id) {
        if (id == null) return null;
        return entityManager().find(Challenge.class, id);
    }
    
    public static List<Challenge> Challenge.findChallengeEntries(int firstResult, int maxResults) {
        return entityManager().createQuery("select o from Challenge o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
    }
    
}
